#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
Fun(int n) {
	int sum = 0;
	for (int i = 1; i < n; i++) {
		if (n % i == 0) {
			sum += i;
		}
	}
	if (sum == n) {
		return 1;
	}
	else return 0;
}
int main() {
	int n = 0;
	int count = 0;
	scanf("%d", &n);
	for (int i = 6; i < n; i++) {
		count+=Fun(i);
	}
	printf("%d", count);
	return 0;
}